package com.fjk.order.controller;

import com.fjk.module.domain.Order;
import com.fjk.order.feign.PointServiceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
@RequestMapping("/order")
public class OrderController {
    @Value("${config.info}")
    String info;

    @Autowired
    private PointServiceFeign pointServiceFeign;

    @GetMapping("/test")
    public String tets(){
        return "order-service";
    }

    @GetMapping("/config")
    public String config(){
        return info;
    }

    @GetMapping("/add")
    public String add(){
        Order order = new Order();
        order.setId(1L);
        order.setProductName("水杯200ML");
        String res = pointServiceFeign.add(order);
        return res;
    }
}
